package utn.frsf.gabinete.fw.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import utn.frsf.gabinete.fw.sample.Auto;


public class GenericDAO{

	public Object crearInstancia(Object c) {
		EntityManager em =null;
	    try {
	    	em = EMF.get().createEntityManager();
	    	em.persist(c);
	    } catch(Exception e) {
	    	e.printStackTrace();
	    }finally {
	    	em.close();
	    }
    	return c;
	}

	public List<Object> getLista(String clase){
		Query q = EMF.get().createEntityManager().createQuery("select from " + clase);
		return q.getResultList();
	}
}
